import { defineConfig,searchForWorkspaceRoot } from "vite";
import Unocss from 'unocss/vite'
import {resolve} from "path"
//
export default defineConfig({
  plugins: [
    Unocss(),
  ],
  // 别名路径参考  .vitepress/config.ts
  // resolve:{
  //   alias:{
  //     "@/":resolve(__dirname),
  //     "@view/":resolve(__dirname,'view/'),
  //     "@doc/":resolve(__dirname,'doc/'),
  //     "@ui/":resolve(__dirname,'../ui/'),
  //   }
  // },
  server:{
    proxy:{
      '/nifi-api':"http://10.90.20.191:29090",
      // '/nifi-api':"http://10.90.20.240:9093",
      // '/hanyun/datadevelop-stream':{
      //   target:"http://10.90.15.233:7017",
      //   rewrite: (path) => path.replace(/^\/hanyun/, ''),
      //   ws: true
      // },
      // '/hanyun/sys':{
      //   target:"http://10.90.15.233:7017",
      //   rewrite: (path) => path.replace(/^\/hanyun/, ''),
      //   ws: true
      // },
      // '/hanyun/datadevelop-stream':{
      //   target:"http://10.90.15.233:7017",
      //   rewrite: (path) => path.replace(/^\/hanyun/, ''),
      //   ws: true
      // },
      // '/hanyun/sys':{
      //   target:"http://10.90.15.233:7017",
      //   rewrite: (path) => path.replace(/^\/hanyun/, ''),
      //   ws: true
      // },
      '/hanyun/datadevelop-stream':{
        // target:"http://10.90.15.233:7017",
        target:"http://10.90.20.191:7017",
        rewrite: (path) => path.replace(/^\/hanyun/, ''),
        ws: true
      },
      '/hanyun/sys':{
        // target:"http://10.90.15.233:7017",
        target:"http://10.90.20.191:7017",
        rewrite: (path) => path.replace(/^\/hanyun/, ''),
        ws: true
      },
    },
    fs: {
      allow: [
        // search up for workspace root
        searchForWorkspaceRoot(process.cwd()),
        // your custom rules
        "../ui/"
      ],
    },
  }
});
